import request from '@u/request'
// 加入购物车
const addCart = (params = {}) => (
  request.post('/shopping-cart/add', params)
)
// 读取购物车数据
const fetchCartInfo = (params = {}) => (
  request.get('/shopping-cart/info', {params})
)
// 修改购物车商品购买数量
const modifyItemNum = (params = {}) => (
  request.post('/shopping-cart/modifyNumber', params)
)
// 删除购物车中的商品
const removeCartItem = (params = {}) => (
  request.post('/shopping-cart/remove', params)
)
// 修改购物车商品选中状态
const changeCartItemSelect = (params = {}) => (
  request.post('/shopping-cart/select', params)
)

export {
  addCart,
  fetchCartInfo,
  modifyItemNum,
  removeCartItem,
  changeCartItemSelect
}